home *** CD-ROM | disk | FTP | other *** search
- /*
- File: DocUtilP.h
-
- Contains: xxx put contents here xxx
-
- Owned by: Nick Pilch
-
- Copyright:
-
- Change History (most recent first):
-
- <2> 12/18/96 DH 1375780: Adding CStackPtrList which is a
- list which allocates memory on the stack
- instead of the heap.
- <1> 18.09.1996 NP first checked in
-
- To Do:
- */
-
- #ifndef _DOCUTILP_
- #define _DOCUTILP_
-
- const int maxListItems = 100;
-
- ODDocument* ODGetFirstOpenDocument(Environment* ev, ODSession* session);
- //------------------------------------------------------------------------------
- // ODGetFirstOpenDocument
- // A pointer to the first document in the collection of open documents is returned.
- // If the collection is empty, then kODNULL is returned.
- // It is the caller's responsibility to Acquire the returned document it she wishes to
- // hold onto it.
- //------------------------------------------------------------------------------
- ODBoolean ODDeleteDocument(Environment* ev, ODSession* session, ODDocument* document);
- //------------------------------------------------------------------------------
- // ODDeleteDocument
- // Saves & closes the document and moves it to the trash.
- // If there are no more open windows once the document is closed,
- // then kODTrue is returned.
- //------------------------------------------------------------------------------
- void ODRevertDocument(Environment* ev, ODSession* session, ODDocument* document);
- //------------------------------------------------------------------------------
- // ODRevertDocument
- // Reverts the document if there is an associated tempdraft. Otherwise does nothing.
- // Note: it is advised that you get a confirmation from the user BEFORE
- // calling this function.
- //------------------------------------------------------------------------------
- ODBoolean ODIsTempDocument(Environment* ev, ODSession* session, ODDocument* document);
- //------------------------------------------------------------------------------
- // ODIsTempDocument
- // Returns whether or not the document is a temp document.
- //------------------------------------------------------------------------------
- void ODSetIsTempDocument(Environment* ev, ODDraft* draft, ODBoolean isTemp);
- //------------------------------------------------------------------------------
- // ODSetIsTempDocument
- // Sets whether the document is a temp document or not.
- //------------------------------------------------------------------------------
-
- // Stack Pointer List class. Stores a list of pointers, but allocates data for the
- // list on the stack, not the heap, so that it will work better under low memory
- // conditions.
-
- // Limitations:
- // Only allows storing, at most, 100 4-byte pointer entries.
- // Do not store null pointers in this list!
-
- class CStackPtrList
- {
- public:
- CStackPtrList( void ) { nextPos = 0; numListItems = 0; }
- ~CStackPtrList() {}
-
- ODError Add( ODPtr theItem );
- ODPtr First( void ) { nextPos = 0; return data[nextPos++]; }
- ODPtr Next( void );
- int GetNumListItems( void) { return numListItems; }
- private:
- ODPtr data[maxListItems]; // The data for all of the pointers in the list.
- int numListItems; // Number of items currently in the list.
- ODUByte nextPos; // Denotes the position in the array of the pointer
- // that will be returned when Next is called.
- };
-
-
- #endif /* _DOCUTILP_ */
-